class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :source_users do |t|
      t.column :username, :string, :null => false
      t.column :password, :string
      t.references :user
      t.references :source
      t.timestamps
    end
    
    create_table :users do |t|
      t.column :name, :string, :null => false
      t.column :password, :string
      t.references :source_user
      t.timestamps
    end
    
    change_table :sources do |t|
      t.references :source_user
    end
  end

  def self.down
    drop_table :users
    drop_table :source_users
    remove_column :sources, :source_user_id
  end
end
